package com.yc.spring;

import com.yc.spring.bbs.bean.Page;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String s) throws BeansException {


        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String s) throws BeansException {

        if (bean instanceof Page){
            Page page =(Page) bean;
            page.setTotal(10000);
        }
        return bean;
    }
}
